package com.todo.content.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/3/19 20:05
 * @description
 */
@Getter
@AllArgsConstructor
public enum ActivityRewardProductTypeEnum {

    PRODUCT(1, "PRODUCT", "实物"),
    SERVICE(2, "SERVICE", "服务"),
    VIRTUAL_PRODUCT(3, "VIRTUAL_PRODUCT", "虚拟产品"),

    ;

    private static Map<Integer, ActivityRewardProductTypeEnum> typeMap = Arrays
            .stream(ActivityRewardProductTypeEnum.values())
            .collect(Collectors.toMap(ActivityRewardProductTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static ActivityRewardProductTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
